// pages/index/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    latitude: 0, //首次加载维度
    longitude: 0, //首次加载的经度
    mapName: "", //选点的位置
    dairy:{},
    like:'/pages/images/13女警察.png',
    isLike:false,
    star:'/pages/images/14男军人.png',
    isStar:false,
    delete:'/pages/images/15女老师.png',
    editor:'/pages/images/3公主.png',
    indicatorDots:true,
    autoplay:true,
    indicatorColor:"#fff",
    indicatorActiveColor:"blue",
    imgs:[
      {img:'/image/good_doctor.png',link:'/pages/doctor_list/doctor_list'},
      {img:'/image/头巾ygf.png'},
      {img:'/image/blood.png'},
      {img:'/image/微医.png'},
      {img:'/image/急诊.png'},
      {img:'/image/重症.png'}
    ],
    menu:""
  },
  //地图选点
  moveToLocation() {
    let that = this;//防止this指向问题
    wx.chooseLocation({
        success: function (res) {
            console.log(res.name);
            //赋值给data中的mapName
            that.setData({
                mapName: res.name
            })
        },
    })
},

  menuList(){
    let token= wx.getStorageSync('token')
    wx.request({
      url: 'http://www.healthcare.com/wzm/menu_list',
      data:{
        token:token
      },
      success:(res)=>{
        this.setData({
          menu:res.data.data
        })
      }
    })
  },

  clickMenu(res){
    var id = res.currentTarget.dataset.id
    switch (id) {
      case 1:
        wx.redirectTo({
          url: '/pages/doctor_list/doctor_list',
        })
        break;
      case 2:
        wx.redirectTo({
          url: '/pages/make/make',
        })
      case 3:
        wx.redirectTo({
          url: '/pages/order/order',
        })
      case 6:
        wx.redirectTo({
          url: '/pages/be_in_hospital/be_in_hospital',
        })
      case 7:
        wx.redirectTo({
          url: '/pages/raffle/raffle',
        })
      case 8:
        wx.redirectTo({
          url: '/pages/exchange/exchange',
        })
      default:
        break;
    }
  },

  /**
   * 医院介绍
   */
  introduce(){
    this.pageRouter.navigateTo({
      url: '/pages/hospital/hospital'
    })
  },

  /**
   * 医院导航
   */
  navigation(){
    this.pageRouter.navigateTo({
      url: '/pages/navigation/navigation'
    })
  },


/**
   * 就诊指南
   */
  guide(){
    this.pageRouter.navigateTo({
      url: '/pages/guide/guide'
    })
  },


  /**
   * 健康百科
   */
  health(){
    this.pageRouter.navigateTo({
      url: '/pages/health/health'
    })
  },



  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.menuList()
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})